<?php

namespace App\Admin\Renderable;

use Dcat\Admin\Support\LazyRenderable;
use Dcat\Admin\Widgets\Table;
use App\Models\ProductSku;


class ProductSkuTable extends LazyRenderable
{
    public function render()
    {
        // 获取ID
        $id = $this->key;


        $data = ProductSku::where('product_id', $id)
            ->get(['title', 'description', 'price', 'stock', 'created_at'])
            ->toArray();

        return Table::make(['标题', '描述', '价格', '库存', '时间'], $data);
    }
}
